package com.czp.dict.mapper.impl;

import java.util.List;

import org.apache.ibatis.session.RowBounds;

import com.czp.dict.mapper.IDictMapper;
import com.czp.dict.model.Dict;
import com.czp.dict.model.DictType;
import com.czp.framework.mapper.BaseMapperSupport;

/**
 * 【环 境】：J2SE 1.7
 * @author   柴志鹏	CHAIZP@GMAIL.COM
 * @version  version 1.0
 * @since    2014-8-5
 */
public class DictMapperImpl extends BaseMapperSupport implements IDictMapper {

	public List<DictType> getDictTypeList(DictType dictType, RowBounds bounds) throws Exception {
		return this.getSqlSession().selectList(
				"com.czp.dict.mapper.IDictMapper.getDictTypeList", dictType, bounds);
	}
	
	public int getDictTypeCount(DictType dictType) throws Exception {
		return this.getSqlSession().selectOne(
				"com.czp.dict.mapper.IDictMapper.getDictTypeCount", dictType);
	}

	public List<Dict> getDictList(Dict dict, RowBounds bounds) throws Exception {
		return this.getSqlSession().selectList(
				"com.czp.dict.mapper.IDictMapper.getDictList", dict, bounds);
	}
	
	public int getDictCount(Dict dict) throws Exception {
		return this.getSqlSession().selectOne(
				"com.czp.dict.mapper.IDictMapper.getDictCount", dict);
	}
	
	public int insertDictType(DictType dictType) throws Exception {
		System.out.println(dictType.toString());
		return this.getSqlSession().insert(
				"com.czp.dict.mapper.IDictMapper.insertDictType", dictType);
	}
	
	public int updateDictType(DictType dictType) throws Exception {
		return this.getSqlSession().update(
				"com.czp.dict.mapper.IDictMapper.updateDictType", dictType);
	}
	
	public int deleteDictType(DictType dictType) throws Exception {
		return this.getSqlSession().update(
				"com.czp.dict.mapper.IDictMapper.deleteDictType", dictType);
	}

	public int insertDict(Dict dict) throws Exception {
		return this.getSqlSession().insert(
				"com.czp.dict.mapper.IDictMapper.insertDict", dict);
	}

	public int updateDict(Dict dict) throws Exception {
		return this.getSqlSession().update(
				"com.czp.dict.mapper.IDictMapper.updateDict", dict);
	}
	
	public int deleteDict(Dict dict) throws Exception {
		return this.getSqlSession().update(
				"com.czp.dict.mapper.IDictMapper.deleteDict", dict);
	}
}
